//
//  WQVisitorController.swift
//  sanwuWeibo
//
//  Created by 王先强 on 15/12/6.
//  Copyright © 2015年 王先强. All rights reserved.
//

import UIKit

class WQVisitorController: UITableViewController {
    
    //登陆标记
    private var logonState = WQAccountViewModel.sharedAccount.isLogin
    var visitorView: WQVisitorView?
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    override func loadView() {
        //根据登陆状态切换view的类型
        logonState ? super.loadView() : setupVisitorView()
    }
    
    private func setupVisitorView() {
        visitorView = WQVisitorView()
        visitorView?.delegate = self

        view = visitorView
    }

}

extension WQVisitorController: WQVisitorViewDelegate {
    ///  点击登陆按钮
    func visitorViewDidLogin() {
        let vc = WQOAuthController()
        let nav = UINavigationController(rootViewController:vc)
        self.presentViewController(nav, animated: true, completion: nil)
    }
    func visitorViewDidRediser() {
        print("注册")
    }
    
}
